#pragma once
#include "DJointFeedback.h"
#include "../DVector3.h"

namespace Skill
{
	namespace Ode
	{
		namespace Joints
		{
			void DJointFeedback::CollectManagedMemory()
			{
				_Force1 = nullptr;
				_Force2 = nullptr;

				_Torque1 = nullptr;
				_Torque2 = nullptr;
			}

			DVector3^ DJointFeedback::Force1::get()
			{				
				if(!_Force1)
					_Force1 = gcnew DVector3(_This->f1);
				else 
					_Force1->_SetPointer(_This->f1,false);
				return _Force1;
			}
			void DJointFeedback::Force1::set(DVector3^ value)
			{
				if(value)
				{
					_This->f1[0] = value->_This[0];
					_This->f1[1] = value->_This[1];
					_This->f1[2] = value->_This[2];
				}
			}

			DVector3^ DJointFeedback::Force2::get()
			{				
				if(!_Force2)
					_Force2 = gcnew DVector3(_This->f2);
				else 
					_Force2->_SetPointer(_This->f2,false);
				return _Force2;
			}
			void DJointFeedback::Force2::set(DVector3^ value)
			{
				if(value)
				{
					_This->f2[0] = value->_This[0];
					_This->f2[1] = value->_This[1];
					_This->f2[2] = value->_This[2];
				}
			}


			DVector3^ DJointFeedback::Torque1::get()
			{				
				if(!_Torque1)
					_Torque1 = gcnew DVector3(_This->t1);
				else 
					_Torque1->_SetPointer(_This->t1,false);
				return _Torque1;
			}
			void DJointFeedback::Torque1::set(DVector3^ value)
			{
				if(value)
				{
					_This->t1[0] = value->_This[0];
					_This->t1[1] = value->_This[1];
					_This->t1[2] = value->_This[2];
				}
			}


			DVector3^ DJointFeedback::Torque2::get()
			{				
				if(!_Torque2)
					_Torque2 = gcnew DVector3(_This->t2);
				else 
					_Torque2->_SetPointer(_This->t2,false);
				return _Torque2;
			}
			void DJointFeedback::Torque2::set(DVector3^ value)
			{
				if(value)
				{
					_This->t2[0] = value->_This[0];
					_This->t2[1] = value->_This[1];
					_This->t2[2] = value->_This[2];
				}
			}

		}
	}
}